Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't use std::popcount (workaround) #8098

Merged
merged 1 commit into from
Apr 25, 2020
Merged

Conversation

Nekotekina
Copy link
Member

Should address #8085

It seems MSVC uses POPCNT instruction when compiling for SSE2.
@@ -1182,7 +1182,7 @@ namespace vm
if (is_write)
std::swap(src, dst);

if (size <= 16 && std::popcount(size) == 1 && (addr & (size - 1)) == 0)
if (size <= 16 && (size & (size - 1)) == 0 && (addr & (size - 1)) == 0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (size <= 16 && (size & (size - 1)) == 0 && (addr & (size - 1)) == 0)
if (size <= 16 && ((size | addr) & (size - 1)) == 0)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is little point to optimize it by hand (the outcome is the same), it only hurts readability due to mixing two different checks.

@Nekotekina Nekotekina merged commit 58ba6d6 into RPCS3:master Apr 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants